package com.prs.crm.action.assets;

import org.apache.struts2.convention.annotation.Action;
import org.courser.struts.BaseAction;
import org.courser.ui.PaginationSupport;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;

import com.prs.crm.context.AppContext;
import com.prs.crm.domain.assets.AssetsScrap;
import com.prs.crm.domain.assets.LingYongHistory;
import com.prs.crm.service.assets.LingYongHistoryService;

public class LingYongHistoryAction extends BaseAction{
	private PaginationSupport pagination;
	private Integer[] ids;
	private LingYongHistoryService lingYongHistoryService;
	private LingYongHistory lingYongHistory;
	public PaginationSupport getPagination() {
		return pagination;
	}
	public void setPagination(PaginationSupport pagination) {
		this.pagination = pagination;
	}
	public Integer[] getIds() {
		return ids;
	}
	public void setIds(Integer[] ids) {
		this.ids = ids;
	}
	public LingYongHistoryService getLingYongHistoryService() {
		return lingYongHistoryService;
	}
	public void setLingYongHistoryService(
			LingYongHistoryService lingYongHistoryService) {
		this.lingYongHistoryService = lingYongHistoryService;
	}
	public LingYongHistory getLingYongHistory() {
		return lingYongHistory;
	}
	public void setLingYongHistory(LingYongHistory lingYongHistory) {
		this.lingYongHistory = lingYongHistory;
	}
	
	////////////////////////////////////////////////////////////////////
	@Action("listLingYongHistory")
	public String listLingYongHistory(){
		DetachedCriteria criteria = this.getPaginationHelper().createQuery(LingYongHistory.class)
		.add(Restrictions.eq("person.id", AppContext.getAccountContext().getUser().getId()));
		this.setPagination(this.lingYongHistoryService.listByPage(criteria, 
				this.getPaginationHelper().prepare(pagination)));		
		return SUCCESS;
	}
}
